<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:conv="clr-namespace:QuickZip.Converters"            
    xmlns:sys="clr-namespace:System;assembly=mscorlib" 
    xmlns:lc="clr-namespace:LoadingControl.Control"
    xmlns:ce="clr-namespace:FileExplorer.WPF.Animations"
    xmlns:bc="clr-namespace:FileExplorer.WPF.BaseControls"
    xmlns:uc="clr-namespace:FileExplorer.WPF.UserControls"
    >

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Brushes.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Default/Geometry.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Converters.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/Buttons.xaml" />
        <ResourceDictionary Source="pack://application:,,,/FileExplorer3.WPF;component/Themes/Common/BreadcrumbParts.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <ControlTemplate x:Key="BreadcrumbTemplate" TargetType="{x:Type uc:BreadcrumbBase}">
        <Border x:Name="bdr">
            <Border BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}" BorderThickness="1">
                <Grid x:Name="BreadcrumbBackgroundGrid" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" >
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto" />
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="Auto" />
                    </Grid.ColumnDefinitions>

                    <ProgressBar Background="Transparent" Foreground="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}"
                             IsIndeterminate="{Binding IsIndeterminate, RelativeSource={RelativeSource TemplatedParent}}" Opacity="0.5" Grid.ColumnSpan="3"
                             Visibility="{Binding IsProgressbarVisible, RelativeSource={RelativeSource TemplatedParent}, 
                                Converter={StaticResource btv}}"
                             Value="{Binding Progress, RelativeSource={RelativeSource TemplatedParent}}" />

                    
                    <ToggleButton x:Name="PART_Toggle"  Grid.Column="0"  Padding="2,0" VerticalAlignment="Stretch"
                                  IsChecked="{Binding IsBreadcrumbVisible, RelativeSource={RelativeSource TemplatedParent}}" 
                                  Width="{TemplateBinding ActualHeight}"
                                  Template="{StaticResource BaseButton}" Background="Transparent" >
                        <ContentControl ContentTemplate="{TemplateBinding IconTemplate}"  
                                        Content="{Binding SelectedValue, RelativeSource={RelativeSource TemplatedParent}}" />                        
                    </ToggleButton>

                    <bc:SuggestBoxBase x:Name="PART_TextBox" Grid.Column="1" BorderBrush="Transparent"
                                   DisplayMemberPath="{Binding DisplayMemberPath, RelativeSource={RelativeSource TemplatedParent}}"
                                   ValuePath ="{Binding ValuePath, RelativeSource={RelativeSource TemplatedParent}}"
                                   Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}}"
                                   Suggestions="{Binding Suggestions, RelativeSource={RelativeSource TemplatedParent}}"
                                   IsEnabled="{Binding IsBreadcrumbVisible, Converter={StaticResource fb}, 
                                              RelativeSource={RelativeSource TemplatedParent}}" 
                                   Visibility="{Binding IsBreadcrumbVisible, Converter={StaticResource fbtvc}, 
                                            RelativeSource={RelativeSource TemplatedParent}}" >
                        <!--<bc:SuggestBoxBase.Text>
                            <Binding Path="SelectedPathValue" RelativeSource="{RelativeSource TemplatedParent}" UpdateSourceTrigger="Explicit">                                
                            </Binding>
                        </bc:SuggestBoxBase.Text>-->
                    </bc:SuggestBoxBase>
                    
                    <bc:BreadcrumbCore x:Name="PART_BreadcrumbCore" Grid.Column="1"
                                   ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource TemplatedParent}}"
                                   RootItemsSource="{Binding RootItemsSource, RelativeSource={RelativeSource TemplatedParent}}"
                                   DropDownHeight="{TemplateBinding DropDownHeight}"
                                   DropDownWidth="{TemplateBinding DropDownWidth}"
                                   HeaderTemplate="{TemplateBinding HeaderTemplate}"
                                   IconTemplate="{TemplateBinding IconTemplate}"
                                   Visibility="{Binding IsBreadcrumbVisible, Converter={StaticResource btvc}, 
                                            RelativeSource={RelativeSource TemplatedParent}}">                        
                    </bc:BreadcrumbCore>

                    <ContentControl Content="{TemplateBinding Buttons}" Grid.Column="2" VerticalAlignment="Stretch" Margin="2,0" />

                </Grid>
            </Border>
        </Border>
    </ControlTemplate>
    
    <Style TargetType="{x:Type uc:BreadcrumbBase}">
        <Style.Resources>
            <Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}" >
                <Setter Property="Margin" Value="1" />
                <Setter Property="VerticalAlignment" Value="Stretch" />
                <Setter Property="VerticalContentAlignment" Value="Center" />
                <Setter Property="Template" Value="{StaticResource BaseButton}" />
            </Style>
        </Style.Resources>
        <Setter Property="Template" Value="{StaticResource BreadcrumbTemplate}" />
        <!--<Setter Property="Height" Value="30" />-->
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>

    </Style>
    
</ResourceDictionary>
